package com.egg.ylt.adapter.record;

import android.view.View;

import com.egg.ylt.R;
import com.egg.ylt.pojo.BabyDynamicMsgEntity;
import com.egg.ylt.presenter.impl.RecordPresenter;
import com.yonyou.framework.library.adapter.rv.ItemViewDelegate;
import com.yonyou.framework.library.adapter.rv.ViewHolder;

/**
 * Created By Dlx
 * on 2019/1/19
 * view type = "999"
 */
public class RecordHeaderViewType implements ItemViewDelegate<BabyDynamicMsgEntity.ListBean> {

    private RecordPresenter mPresenter;

    public RecordHeaderViewType(RecordPresenter mPresenter) {
        this.mPresenter = mPresenter;
    }

    @Override
    public int getItemViewLayoutId() {
        return R.layout.item_record_addpic;
    }

    @Override
    public boolean isForViewType(BabyDynamicMsgEntity.ListBean item, int position) {
        if ("999".equals(item.getRecordType())) {
            return true;
        }
        return false;
    }

    @Override
    public void convert(ViewHolder holder, BabyDynamicMsgEntity.ListBean babyDynamicMsgEntity, int position) {
        holder.setOnClickListener(R.id.record_addpic_textview, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mPresenter.choosePicType();
            }
        });
        holder.setText(R.id.record_date_days_textview, babyDynamicMsgEntity.getDate());
    }
}
